<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <link rel="stylesheet" data-th-replace="~{public::layui}">
    <style>
        .layui-form .btns {
            text-align: center;
        }

        body {
            padding-top: 20px;
            padding-right: 10px;
        }
    </style>
</head>
<body>
<form class="layui-form">
    <input type="hidden" name="id" data-th-value="${resources.id}">
    <div class="layui-form-item">
        <div class="layui-form-label">父资源:</div>
        <div class="layui-input-inline">
            <select name="pid">
                <option value="-1">请选择父资源</option>
                <option data-th-each="res : ${resourceList}" data-th-selected="${res.id == resources.pid}"
                        data-th-value="${res.id}" data-th-text="${res.name}"></option>
            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-form-label">资源名称:</div>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="name" data-th-value="${resources.name}" lay-verify="required"
                   lay-reqText="资源名称不能为空">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-form-label">资源代码:</div>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="code" data-th-value="${resources.code}" lay-verify="required"
                   lay-reqText="资源代码不能为空">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-form-label">资源路径:</div>
        <div class="layui-input-inline">
            <input type="text" class="layui-input" name="url" data-th-value="${resources.url}">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-form-label">资源类型:</div>
        <div class="layui-input-inline">
            <select type="text" class="layui-input" name="type" lay-verify="required" lay-reqText="资源类型不能为空">
                <option value="">请选择资源类型</option>
                <option data-th-each="resourceType : ${resourceTypes}"
                        data-th-value="${resourceType.id}"
                        data-th-text="${resourceType.name}"
                        data-th-selected = "${resources.type == resourceType.id}" ></option>
            </select>
        </div>
    </div>
    <div class="layui-form-item btns">
        <button class="layui-btn-normal layui-btn " lay-submit lay-filter="update-form"><i
                class="layui-icon layui-icon-edit"></i>修改资源
        </button>
    </div>
</form>
<script data-th-replace="~{public::js('resources','资源','update')}"></script>
</body>
</html>